package com.py.pythink.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import com.py.pythink.entity.UserFollow;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserFollowDao extends BaseMapper<UserFollow> {
    @Select("select * from t_userfollow where uid=#{uid} and fuid=#{fuid}")
    UserFollow getInstance(int uid,int fuid);

    @Insert("insert into t_userfollow(uid,uname,fuid,sname,flag) values(#{uid},#{uname},#{fuid},#{sname},1)" )
    int insertt(UserFollow userFollow);

    //修改关注的状态
    @Update("update t_userfollow set flag=#{flag} where uid=#{uid} and fuid=#{fuid}")
    int updateflag(int flag,int uid,int fuid);

    //获得被关注人的集合
    @Select("select * from t_userfollow where uid=#{uid}")
    List<UserFollow> listattention(int uid);

}
